package cn.tedu.spring.eg3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Scope
@Controller
public class ShopController {
    private String name;

    public ShopController() {
        System.out.println("1.调用构造方法实例化");
    }
@Value("李四")
    public void setName(String name) {
        this.name = name;
    System.out.println("2.在set方法上属性赋值");
    }
    @PostConstruct
    public  void  init(){
        System.out.println("3.执行生命周期初始化");
    }
    @PreDestroy
    public  void destory(){
        System.out.println("5.执行生命周期销毁方法");
    }
}
